﻿<?php
// ------------------------------------------------------------------
// NEEDED STUBS FOR THIS EXAMPLE
// ------------------------------------------------------------------
// this will include all needed files to be able to build a Request


include_once($CONF["STUBS_FOLDER"]."Map24LocationService/Map24LocationService.php5");


// ------------------------------------------------------------------
// NEEDED PARAMETERS FOR THIS REQUEST
// ------------------------------------------------------------------


$Street= 'Duesseldorfer Str.';
$City= 'Eschborn';
$ZIP= '65760';
$Country= 'DE';

$Offset=0;
$Count=10;

// Avalible Layers
// 1|2|4|5|6|7|8|9|10|11|12|13|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|51|52|53|54|55|56|57|58|59|60|61|62|63|64|65|66|67|68|69|70|71|93|94|95|96|97|98|99|100|103|104|105|106|107|108|110|3001|3002|3003|3004|3005|3006|3007|3008|3009|3010|3011|3012|3013|3014

$LayerID='10|15';

// Avalible CustomerLayers
// 7779|7778|7780|3509|3510|3511|3512|73|6926|74|75|76|77|5571|5572|5570|7779|7778|7780|6926|5362|8395|8398|8405|8396|8397|8402|8394|8401|8404|8399|8403|8400|7324|3563|5902|5900|5901|5621|9236|9121|9237|9120|9122|8992|8990|8991|3767|5606|5607|5636|5761|5997|7361|7362|7363|5571|5572|5570
// $CustomerLayerID='3510|3511';


// ------------------------------------------------------------------
// BUILDING THE REQUEST
// ------------------------------------------------------------------


// definition of the request header with Map24ID and SessionID
$header = new RequestHeader();
$header->Map24ID  = $CONF['MAP24_ID'];
$header->ClientID = $CONF['SESSION_ID'];

// definition of the request body
$request = new ReadLocationsRequest();
$request->Address = new Address();
$request->Address->Street= $Street;
$request->Address->City= $City;
$request->Address->ZIP= $ZIP;
$request->Address->Country= $Country;
$request->Offset = $Offset;
$request->Count = $Count;
$request->Map24LayerIDs = array($LayerID);
// if you want to search for customerLayerIDs usw this
//$request->CustomerLayerIDs = array($CustomerLayerID);


// ------------------------------------------------------------------
// EXECUTE THE REQUEST
// ------------------------------------------------------------------


// in this object the SoapClient will be initiated and executed
$maploc = new Map24LocationService($CONF['MAPTP_SYSTEM'],$CONF['MAP24_ID'],$CONF['SESSION_ID']);
$response = $maploc->readLocations($header,$request);


// ------------------------------------------------------------------
// OUTPUT THE RESULT
// ------------------------------------------------------------------


if( isset($response->Map24Layers) )
{
	foreach ($response->Map24Layers as $result)
	{
		$counter++;
		$resultString .= "<div style='border:1px solid black;margin:2px 0px;padding:5px;'>".$counter.". ";
		$resultString .= "<b>LayerID: " . $result->LayerID . "</b><br /><br />";
		$resultString .= "Name: " . $result->Name . "<br /><br />";
		$resultString .= "Description: " . $result->Description . "<br /><br />";
		$resultString .= "</div>";
	}
}
else
{
	$resultString = "Sorry, no layers found";
}

?>